<template>
    <view class="content">
        <!-- <image src="../../static/del/map.jpg" class="map"></image> -->
        <map style="width: 750rpx; height: 600rpx;" :latitude="latitude" :longitude="longitude" :markers="covers"></map>
        <view class="wrapper">
            <view class="nav">
                <scroll-view scroll-x>
                    <view class="nav-list">
                        <view class="nav-i" :class="{activeF : index == 2}" 
                            v-for="(item, index) in 5" :key="index">公交</view>
                    </view>
                </scroll-view>
            </view>
            <view class="navS">
                <scroll-view scroll-x>
                    <view class="nav-list-s">
                        <view class="nav-i-s" :class="{activeS : index == 1}" v-for="(item, index) in 10" :key="index">地铁</view>
                    </view>
                </scroll-view>
            </view>
            <view class="item" v-for="(item, index) in data" :key="index">
                <image src="../../static/icon/add_02.png" class="add-02"></image>
                <view class="item-r">
                    <view class="name">{{item.name}}</view>
                    <view class="item-r-d">
                        <!-- <view>164路</view> -->
                        <view class="u-flex-1">距{{item.distance}}m</view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                latitude: '',
                longitude: '',
                data: [],
                covers: [],
            };
        },
        onLoad(option) {
            console.log(option)
            this.latitude = option.latitude
            this.longitude = option.longitude
            this.getAppLocation()
        },
        methods: {
            getAppLocation() {
                const _this = this;
                _this.$amapPlugin.getRegeo({
                    location: `${_this.longitude},${_this.latitude}`,
                	success: res => {
                        console.log('周边',res)
                        _this.data = res[0].regeocodeData.pois
                	},
                	fail: err => {
                		console.log('失败',err)
                	}
                });
            },
        }
    };
</script>

<style lang="scss">
    
    page{
        background-color: #fff;
    }
    .map{
        width: 750rpx;
        height: 600rpx;
        position: relative;
        z-index: -1;
    }
    .wrapper{
        background-color: #fff;
        border-radius: 25rpx 25rpx 0 0;
        min-height: calc(100vh - 600rpx);
        padding: 20rpx 20rpx 0;
        margin-top: -20rpx;
    }
    .nav{
        width: 710rpx;
        white-space: nowrap;
    }
    .navS{
        width: 710rpx;
        padding-bottom: 15rpx;
        white-space: nowrap;
    }
    .nav-list{
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 35rpx 0;
    }
    .nav-list-s{
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: flex-start;
    }
    .nav-i-s{
        padding: 13rpx 25rpx;
        background-color: #f5f5f5;
        border-radius: 50rpx;
        margin-right: 15rpx;
        font-size: 26rpx;
        box-sizing: border-box;
    }
    .activeS{
        color: #00a1e9;
        border: 2rpx solid #00a1e9;
        background-color: #effafe;
        box-sizing: border-box;
    }
    .nav-i{
        font-size: 30rpx;
        padding: 0 35rpx;
        position: relative;
    }
    .activeF{
        font-size: 34rpx;
        font-weight: bold;
    }
    .activeF::after{
        content: '';
        display: block;
        width: 38rpx;
        height: 7rpx;
        background-color: #00a1e9;
        border-radius: 25%;
        position: absolute;
        bottom: -15rpx;
        left: 66rpx;
        transform: translateX(-50%);
    }
    
    .item{
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding-top: 20rpx;
    }
    .add-02{
        width: 24rpx;
        height: 29rpx;
        margin-right: 15rpx;
        margin-top: 5rpx;
    }
    .item-r{
        flex: 1;
        border-bottom: 2rpx solid #e6e6e6;
        padding-bottom: 20rpx;
    }
    .name{
        font-size: 28rpx;
        font-weight: bold;
    }
    .item-r-d{
        font-size: 24rpx;
        color: #878787;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 10rpx;
    }
</style>
